'use strict';
var transliteration = require('transliteration');
var slugify = transliteration.slugify;
var tr = transliteration.transliterate;
module.exports = function(中药材) {
  中药材.getSmallListWithPY=function(id,cb){
    中药材.find({
      fields:{
        "图片":false,
        "中国药典":false,
        "辞典":false,
        "中华本草":false
      }
    }, function(err, zycs) {
      zycs.forEach(function(zyc) {
        zyc.拼音=tr(zyc["品名:"]);
      });
      cb(null, zycs);
    });
  }

  中药材.remoteMethod(
    'getSmallListWithPY',
    {
      description: '获取所有字典名录,带拼音名称',
      accepts: [
        {arg: 'id', type: 'string'}],
      returns: {arg: 'zycs', type: 'array', root: true, description: '返回描述'},
      http: {verb: 'get',path: '/getSmallListWithPY'}
    }
  );

};
